package com.sugon.webservice.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author wzb
 * @version V1.0.0
 * @desciption feign请求全局添加Token
 * @date 2021/4/15 19:15
 * @className MyFeignRequestInterceptor
 */
@Configuration
public class MyFeignRequestInterceptor  implements RequestInterceptor {


    @Value("${xy.uuid}")
    String xyUuid;

    @Value("${xy.workspaceId}")
    String xyWorkSpaceId;

    @Value("${xy.account}")
    String xyAccount;

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header("account", xyAccount);
        requestTemplate.header("workspaceId", xyWorkSpaceId);
        requestTemplate.header("uuid", xyUuid);
    }
}
